package com.github.data_manage.domain.po

import cn.idev.excel.annotation.ExcelIgnore
import cn.idev.excel.annotation.ExcelProperty
import com.github.data_manage.domain.dto.PersonRelationDto
import com.github.data_manage.util.JpaPersonRelationJsonConverter
import jakarta.persistence.*
import jakarta.validation.constraints.NotBlank
import org.springframework.format.annotation.DateTimeFormat
import java.io.Serializable
import java.time.LocalDate
import java.time.LocalDateTime


/**
 *
 *
 * 人物表
 *
 *
 * @author macro
 * @since 2024-07-06
 */
@Entity
@Table(name = "t_persons")
open class Persons : Serializable {
    //人物ID")
    @Id
    @Column(name = "person_id")
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @ExcelIgnore
    open var personId: Int? = null

    //姓名")
    @NotBlank(message = "姓名不能为空")
    @ExcelProperty("姓名", index = 0)
    open var name: String? = null

    // 英文名
    @ExcelProperty("英文名", index = 1)
    open var englishName: String? = null

    // 成长经历
    @ExcelProperty("成长经历", index = 2)
    open var growingUp: String? = null

    // 第三方
    @ExcelProperty("第三方", index = 3)
    open var thirdParty: String? = null

    // 投资风格
    @ExcelProperty("投资风格", index = 4)
    open var investmentStyle: String? = null

    // 其他描述
    @ExcelProperty("其他描述", index = 5)
    open var note: String? = null


    //创建时间")
    @ExcelIgnore
    open var createTime: LocalDateTime? = null

    // 当前就职公司名字
    @ExcelIgnore
    open var currentCompany: String? = null

    // 当前就职公司id
    @ExcelIgnore
    open var currentCompanyId: Int? = null

    // 当前公司职位
    @ExcelIgnore
    open var currentCompanyPosition: String? = null

    // 当前公司入职时间
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @ExcelIgnore
    open var currentCompanyInTime: LocalDate? = null

    // 最高学历学校
    @ExcelIgnore
    open var highestSchool: String? = null

    // 最高学历学校
    @ExcelIgnore
    open var highestSchoolId: Int? = null

    // 朋友
    @Convert(converter = JpaPersonRelationJsonConverter::class)
    @ExcelIgnore
    open var friends: List<PersonRelationDto>? = null

    @ExcelProperty("linkedin", index = 6)
    open var linkedin: String? = null
}

